package com.shelpe.services.scheduler.item.campaign;

import java.util.List;

import org.springframework.batch.item.ItemWriter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.shelpe.services.scheduler.po.Campaigns;
import com.shelpe.services.scheduler.repository.CampaignsRepository;

@Component("campaignWriter")
public class CampaignsWriterImpl implements ItemWriter<Campaigns>{


	@Autowired
	private CampaignsRepository camRep;
	
	@Override
	public void write(List<? extends Campaigns> items) throws Exception {
		// TODO Auto-generated method stub
		if(items != null && items.size() > 0){
			camRep.save(items);
		}
	}

}
